package com.example.activity;

import java.util.List;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.example.application.ExitApplication;
import com.example.drawer.R;
import com.example.json.JsonHander;

public class FloorActivity extends Activity {
	private ListView listView;
	private ArrayAdapter<String> adapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_floor);
		
		listView = (ListView)this.findViewById(R.id.listView_floor);
		JsonHander jhander = ExitApplication.getInstance().getJsonInstance();
	    List<String> list =	jhander.getFloor();
	    adapter = new ArrayAdapter<String>(FloorActivity.this, android.R.layout.simple_list_item_1, list);
	    listView.setAdapter(adapter);
	    listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int position,
					long arg3) {
				Intent intent = new Intent(FloorActivity.this,RoomActivity.class);
				intent.putExtra("pos", position);
				startActivity(intent);
			}
		});
	}

}
